<template>
	<view class="app app-bg">
		<!-- 页面内容开始 -->
		<u-cell-group>
			<u-cell-item :title="$t('setting.third-party-account-association')" :label="$t('setting.third-party-account-association-tips')" :label-style="labelStyle" @click="pageTo('/pages/user/setting/account-associated')"></u-cell-item>
			<u-cell-item v-if="isBindMobileCom" :title="$t('setting.modify-mobile')" :label="$t('setting.modify-mobile-tips')" :label-style="labelStyle" :value="bindMobileCom" @click="pageTo('/pages/user/setting/update-mobile?pageIndex=0')"></u-cell-item>
			<u-cell-item v-else :title="$t('setting.bind-mobile')" :label="$t('setting.bind-mobile-tips')" :label-style="labelStyle" :value="$t('setting.click-bind')" @click="pageTo('/pages/user/setting/update-mobile?pageIndex=1')"></u-cell-item>
			<u-cell-item v-if="isBindEmailCom" :title="$t('setting.modify-email')" :label="$t('setting.modify-email-tips')" :label-style="labelStyle" :value="bindEmailCom" @click="pageTo('/pages/user/setting/update-mailbox?pageIndex=0')"></u-cell-item>
			<u-cell-item v-else :title="$t('setting.bind-email')" :label="$t('setting.bind-email-tips')" :label-style="labelStyle" :value="$t('setting.click-bind')" @click="pageTo('/pages/user/setting/update-mailbox?pageIndex=1')"></u-cell-item>
			<u-cell-item v-if="isBindMobileCom" :title="$t('setting.modify-login-password')" :label="$t('setting.modify-login-password-tips')" :label-style="labelStyle" @click="pageTo('/pages/user/setting/update-password')"></u-cell-item>
		</u-cell-group>

		<!-- 页面内容结束 -->
	</view>
</template>

<script>
	var vk = uni.vk;			// vk依赖
	export default {
		data() {
			// 页面数据变量
			return {
				labelStyle:{
					color:"#C0C0C0",
					fontSize:"24rpx"
				},
				// init请求返回的数据
				data:{

				},
				// 表单请求数据
				form1:{

				},
				scrollTop:0,
			}
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop;
		},
		// 监听 - 页面每次【加载时】执行(如：前进)
		onLoad(options = {}) {
			vk = uni.vk;
			this.options = options;
			this.init(options);
		},
		// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快，会在页面进入动画完成前触发
		onReady(){},
		// 监听 - 页面每次【显示时】执行(如：前进和返回) (页面每次出现在屏幕上都触发，包括从下级页面点返回露出当前页面)
		onShow() {},
		// 监听 - 页面每次【隐藏时】执行(如：返回)
		onHide() {},
		// 函数
		methods: {
			// 页面数据初始化函数
			init(options){
				let that = this;
				console.log("init: ",options);
				uni.setNavigationBarTitle({
					title: this.$t('page.account-security')
				});
			},
			pageTo(path){
				vk.navigateTo(path);
			}
		},
		// 监听器
		watch:{

		},
		// 计算属性
		computed:{
			isBindMobileCom(){
				let userInfo = vk.getVuex("$user.userInfo");
				return userInfo && userInfo.mobile ? true : false;
			},
			isBindEmailCom(){
				let userInfo = vk.getVuex("$user.userInfo");
				return userInfo && userInfo.email ? true : false;
			},
			bindMobileCom(){
				let mobile = vk.getVuex("$user.userInfo.mobile");
				return vk.pubfn.hidden(mobile, 3, 4);
			},
			bindEmailCom(){
				let email = vk.getVuex("$user.userInfo.email");
				return vk.pubfn.hidden(email, 2, 9);
			},
		}
	}
</script>
<style lang="scss" scoped>

</style>
